package hoang.hut.app.utility;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class GsonUtility {

	public static <T>Object convertJsonToObject(String json, Class<T> classOfT){
		GsonBuilder gsonBuilder = new GsonBuilder();
		Gson gson = gsonBuilder.create();
		Object object = new Object();
		object = gson.fromJson(json, classOfT);
		return object;
	}
	
	public static String convertObjectToString(Object obj){
		GsonBuilder gsonBuilder = new GsonBuilder();
		Gson gson = gsonBuilder.create();
		String str = gson.toJson(obj);
		return str;
	}

}
